// name=getCookie("name");
$('.first_nav').bind('click',function(){
	nav_array[0].attr('src','../../IMG/send1.png');
	nav_array[1].attr('src','../../IMG/data.png');
	nav_array[2].attr('src','../../IMG/member.png');
	nav_array[3].attr('src','../../IMG/fliter.png');
	nav_array[4].attr('src','../../IMG/plugs.png');
	nav_array[5].attr('src','../../IMG/flow.png');
	$('.right_content').load('inc/message_issue.html',function(){
		$('.add').bind('click',i=1,function(){
			var img=".img"+i;
			$(img).css({display:"inline"});
			i++;
			if(i==4){
				$(this).css({display:"none"});
			}
		});
		$('#message_issue').ajaxForm({
			url: '../../controllers/message_issuecontroller.php',
        	error: failSubmit,
        	success: successSubmit,
        	dataType: 'json'
    	});
    	$('.img input').each(function(){
			$(this).change(function(){
				img_small(this);
			});
		});
	});
});

var nav_array=new Array();
nav_array[0]=$(".first_nav img");
nav_array[1]=$(".second_nav img");
nav_array[2]=$(".third_nav img");
nav_array[3]=$(".forth_nav img");
nav_array[4]=$(".fifth_nav img");
nav_array[5]=$(".six_nav img");
/**************数据统计**************/
$('.second_nav').bind('click',function(){
	nav_array[0].attr('src','../../IMG/send.png');
	nav_array[1].attr('src','../../IMG/data1.png');
	nav_array[2].attr('src','../../IMG/member.png');
	nav_array[3].attr('src','../../IMG/fliter.png');
	nav_array[4].attr('src','../../IMG/plugs.png');
	nav_array[5].attr('src','../../IMG/flow.png');
	$('.right_content').load('inc/data_statistics.html',function(){
		// post请求sex_data.php
		$.post("../../controllers/sex_data.php",function(result){
			console.log(result);
			json_result = eval("(" + result + ")");
			console.log(json_result.result);
			switch(json_result.result){
				case "1":
					console.log(json_result.data);
					json_result = eval("(" + json_result.data + ")");
					var tyarr=new Array();
					tyarr[0]="male";
					tyarr[1]="female";
					var valarr=new Array();
					valarr[0]=json_result.male;
					valarr[1]=json_result.female;
					divid="pie";
					console.log(valarr+tyarr);
					//pie
					sex_statistics_pie(tyarr,valarr,divid);
					divid="bar";
					//bar
					sex_statistics_line(tyarr,valarr,divid);
					//动态评论
					var content="";
					if(valarr[0]>valarr[1]){
						if(valarr[0]/valarr[1]==1){
							content+="男的数量略大于女，比较平衡";
						}
						else if(valarr[0]/valarr[1]<=3){
							content+="男的数量大约是女的<span>";
							var x=valarr[1]%valarr[0];
							x=(valarr[1]-x)/valarr[0];
							content+=x;
							content+="</span>倍,男女比例失衡。";
						}
						else{
							content+="男的数量大约是女的<span>";
							var x=valarr[1]%valarr[0];
							x=(valarr[1]-x)/valarr[0];
							content+=x;
							content+="</span>倍,男女比例严重失衡";
						}
					}
					if(valarr[1]>valarr[0]){
						if(valarr[1]/valarr[0]==1){
							content+="女的数量略大于男，比较平衡";
						}
						else if(valarr[1]/valarr[0]<=3){
							content+="女的数量大约是男的<span>";
							var x=valarr[1]%valarr[0];
							x=(valarr[1]-x)/valarr[0];
							content+=x;
							content+="</span>倍,男女比例失衡。";
						}
						else{
							content+="女的数量大约是男的<span>";
							var x=valarr[1]%valarr[0];
							x=(valarr[1]-x)/valarr[0];
							content+=x;
							content+="</span>倍,男女比例严重失衡";
						}
					}
					$('.dynamic_content').html(content);
					break;
				default:

					break;
			}

		});
	});
});

/**************成员管理***************/
$('.third_nav').bind('click',function(){
	nav_array[0].attr('src','../../IMG/send.png');
	nav_array[1].attr('src','../../IMG/data.png');
	nav_array[2].attr('src','../../IMG/member1.png');
	nav_array[3].attr('src','../../IMG/fliter.png');
	nav_array[4].attr('src','../../IMG/plugs.png');
	nav_array[5].attr('src','../../IMG/flow.png');
	$('.right_content').load('inc/member_manage.html',function(){
		var page=$('.page').text();
		console.log(page);
		$.post('../../controllers/members.php',{'page':page},function(result){
			console.log("member:"+result);
			json_result = eval("(" + result + ")").result;
			switch(json_result){
				case "1":
					json_user= eval("(" + result + ")").users;
					console.log(json_user);
					var varcontent="<tr><td>user_id</td><td>user_name</td><td>粉丝数</td><td>关注数</td><td></td></tr>";
					$('.members table').html(varcontent);
					for (var i = json_user.length - 1; i >= 0; i--) {
						var user=json_user[i];
						varcontent="<tr><td>"+user.user_id+"</td><td>"+user.user_name+"</td><td>"+user.follow_num+"</td><td>"+user.focus_num+"</td><td class=\'detail\'><button><img src=\'../../IMG/detail.png\'></button></td></tr>";
						$('.members table').append(varcontent);
					};
					break;
				default:
					$(".alert").html("刷新重新获取").fadeToggle();
					$(".alert").fadeToggle(3000);
					break;
			}
			$('.detail').each(function(){
				$(this).click(function(){
					var obj=$(this).parent().parent();
					var user_id=$(this).parent().children().first().text();
					console.log(user_id);
					$.post("../../controllers/user_detail.php",{'user_id':user_id},function(result){
						json_result=eval("(" + result + ")");
						console.log(json_result.user_name);
						var varcontent="<ul>";
						for(key in json_result){
							if(json_result[key]==""){
								continue;
							}
							if(key=="result"){
								continue;
							}
							varcontent+="<li><span>";
							varcontent+=key;
							varcontent+="</span>";
							varcontent+=json_result[key];
							varcontent+="</li>";
						}
						varcontent+="</ul>";
						console.log(varcontent);
						console.log(obj);
						$('.user_detail').html(varcontent);
					});
				});
			});
		});
		// $('.uppage').bind('click',{'page':page,'type':'1'},userListget);
		// $('.downpage').bind('click',{'page':page,'type':'2'},userListget);
		$('.uppage').bind('click',function(){
			if(parseInt(page)>1){
				page=parseInt(page)-1;		
			}
			$('.page').text(page);
			console.log(page);
			$.post('../../controllers/members.php',{'page':page},function(result){
				console.log("member:"+result);
				json_result = eval("(" + result + ")").result;
				switch(json_result){
					case "1":
						json_user= eval("(" + result + ")").users;
						console.log(json_user);
						var varcontent="<tr><td>user_id</td><td>user_name</td><td>粉丝数</td><td>关注数</td><td></td></tr>";
						$('.members table').html(varcontent);
						for (var i = json_user.length - 1; i >= 0; i--) {
							var user=json_user[i];
							varcontent="<tr><td>"+user.user_id+"</td><td>"+user.user_name+"</td><td>"+user.follow_num+"</td><td>"+user.focus_num+"</td><td class=\'detail\'><button><img src=\'../../IMG/detail.png\'></button></td></tr>";
							$('.members table').append(varcontent);
						};
						break;
					default:
						$(".alert").html("刷新重新获取").fadeToggle();
						$(".alert").fadeToggle(3000);
						break;
				}
				$('.detail').each(function(){
					$(this).click(function(){
						var obj=$(this).parent().parent();
						var user_id=$(this).parent().children().first().text();
						console.log(user_id);
						$.post("../../controllers/user_detail.php",{'user_id':user_id},function(result){
							json_result=eval("(" + result + ")");
							console.log(json_result.user_name);
							var varcontent="<ul>";
							for(key in json_result){
								if(json_result[key]==""){
									continue;
								}
								if(key=="result"){
									continue;
								}
								varcontent+="<li><span>";
								varcontent+=key;
								varcontent+="</span>";
								varcontent+=json_result[key];
								varcontent+="</li>";
							}
							varcontent+="</ul>";
							console.log(varcontent);
							console.log(obj);
							$('.user_detail').html(varcontent);
						});
					});
				});
			});
		});
		$('.downpage').bind('click',function(){
			page=parseInt(page)+1;
			$('.page').text(page);
			console.log(page);
			$.post('../../controllers/members.php',{'page':page},function(result){
				console.log("member:"+result);
				json_result = eval("(" + result + ")").result;
				switch(json_result){
					case "1":
						json_user= eval("(" + result + ")").users;
						console.log(json_user);
						var varcontent="<tr><td>user_id</td><td>user_name</td><td>粉丝数</td><td>关注数</td><td></td></tr>";
						$('.members table').html(varcontent);
						for (var i = json_user.length - 1; i >= 0; i--) {
							var user=json_user[i];
							varcontent="<tr><td>"+user.user_id+"</td><td>"+user.user_name+"</td><td>"+user.follow_num+"</td><td>"+user.focus_num+"</td><td class=\'detail\'><button><img src=\'../../IMG/detail.png\'></button></td></tr>";
							$('.members table').append(varcontent);
						};
						break;
					default:
						$(".alert").html("刷新重新获取").fadeToggle();
						$(".alert").fadeToggle(3000);
						break;
				}
				$('.detail').each(function(){
					$(this).click(function(){
						var obj=$(this).parent().parent();
						var user_id=$(this).parent().children().first().text();
						console.log(user_id);
						$.post("../../controllers/user_detail.php",{'user_id':user_id},function(result){
							json_result=eval("(" + result + ")");
							console.log(json_result.user_name);
							var varcontent="<ul>";
							for(key in json_result){
								if(json_result[key]==""){
									continue;
								}
								if(key=="result"){
									continue;
								}
								varcontent+="<li><span>";
								varcontent+=key;
								varcontent+="</span>";
								varcontent+=json_result[key];
								varcontent+="</li>";
							}
							varcontent+="</ul>";
							console.log(varcontent);
							console.log(obj);
							$('.user_detail').html(varcontent);
						});
					});
				});
			});
		});
	});
});

/**************敏感词过滤*************/
$('.forth_nav').bind('click',function(){
	nav_array[0].attr('src','../../IMG/send.png');
	nav_array[1].attr('src','../../IMG/data.png');
	nav_array[2].attr('src','../../IMG/member.png');
	nav_array[3].attr('src','../../IMG/fliter1.png');
	nav_array[4].attr('src','../../IMG/plugs.png');
	nav_array[5].attr('src','../../IMG/flow.png');
	$('.right_content').load('inc/sensitive_words.html',function(){
		$('.page_type').load('inc/add_sensitive_word.html',function(){
				/*加载数据库已有的敏感词*/
			$.post("../../controllers/sensitivitycontroller.php",{"type":"0"},function(result){
				console.log(result);
				json_result = eval("(" + result + ")");
				switch(json_result.result){
					case "1":
						console.log("success result");
						break;
					default:
						$(".alert").html("刷新重新获取").fadeToggle();
						$(".alert").fadeToggle(3000);
						break;
				}
				console.log(json_result.array_content);
				for(key in json_result.array_content){
					console.log(key);
					console.log(json_result.array_content[key]);
					var classname="."+key;
					$(classname).css({display:"block"});

					var value=json_result.array_content[key].split(/;/);
					var varcontent="";
					for (var i = value.length - 1; i >= 0; i--) {
						varcontent+="<li>"+value[i]+"</li>";
					};
					$(classname).append(varcontent);
					classname="."+key+" .head_li";
					console.log(classname);
					$(classname).html(key);
				}
				$('#submit_add').bind('click',{'type':'1'},modifySensitivity);
				$('#submit_delete').bind('click',{'type':'2'},modifySensitivity);
			});
		});
		/*************管理员添加敏感词**************/
		$('#add_words').bind('click',function(){
			$('#words_note img').attr("src","../../IMG/history_words.png");
			$('#add_words img').attr("src","../../IMG/add_words1.png");
			$('.page_type').load('inc/add_sensitive_word.html',function(){
				/*加载数据库已有的敏感词*/
				$.post("../../controllers/sensitivitycontroller.php",{"type":"0"},function(result){
					console.log(result);
					json_result = eval("(" + result + ")");
					switch(json_result.result){
						case "1":
							console.log("success result");
							break;
						default:
							$(".alert").html("刷新重新获取").fadeToggle();
							$(".alert").fadeToggle(3000);
							break;
					}
					console.log(json_result.array_content);
					for(key in json_result.array_content){
						console.log(key);
						console.log(json_result.array_content[key]);
						var classname="."+key;
						$(classname).css({display:"block"});

						var value=json_result.array_content[key].split(/;/);
						var varcontent="";
						for (var i = value.length - 1; i >= 0; i--) {
							varcontent+="<li>"+value[i]+"</li>";
						};
						$(classname).append(varcontent);
						classname="."+key+" .head_li";
						console.log(classname);
						$(classname).html(key);
					}
				});
				$('#submit_add').bind('click',{'type':'1'},modifySensitivity);
				$('#submit_delete').bind('click',{'type':'2'},modifySensitivity);
			});
		});
		/*****************敏感词审查******************/
		$('#words_note').bind('click',function(){
			$('#words_note img').attr("src","../../IMG/history_words1.png");
			$('#add_words img').attr("src","../../IMG/add_words.png");
			$('.page_type').load('inc/note_sensitive_word.html',function(){
				$.post("../../controllers/sensitivity_record.php",function(result){
					console.log(result);
					json_result = eval("(" + result + ")").result;
					if(json_result.length==0){
						console.log(json_result.length+"length");
					}
					for (var i = json_result.length - 1; i >= 0; i--) {
						var tweets_id= json_result[i].tweets_id;
						var tweets_content= json_result[i].tweets_content;
						var varcontent="<tr><td>"+tweets_id+"</td><td>"+tweets_content+"</td><td class=\'detail\'><button><img src=\'../../IMG/detail.png\'></button></td><td class=\'pass\'><button><img src=\'../../IMG/pass.png\'></button></td><td class=\'notpass\'><button><img src=\'../../IMG/nopass.png\'></button></td></tr>";
						console.log(varcontent);
						$('.record table').append(varcontent);
					};
					$('.record table').append("<tr><td></td><td></td><td></td><td></td><td></td></tr>");
					$("[class='detail']").bind('click',function(){
						$('.detail_div').css({display:"block"});
						var tweets_id=$(this).parent().children().first().text();
						console.log(tweets_id);
						$.post('../../controllers/whichsensitivity_word.php',{"tweets_id":tweets_id},function(result){
							console.log(result);
							result=eval("(" + result + ")").result;
							var varcontent="<ul><li><span>tweets_id</span>"+result.tweets_id+"</li><li><span>user_id</span>"+result.user_id+"</li><li><span>tweets_content</span>"+result.tweets_content+"</li></ul>";
							$('.detail_content .detail_div').html(varcontent);
						});
					});
					$(".pass").each(function(){
						$(this).click(function(){
							var tweets_id=$(this).parent().children().first().text();
							$.post("../../controllers/checksensitivity_word.php",{'tweets_id':tweets_id,'tweets_status':'0'},function(result){
								console.log(eval("(" + result + ")").result);
								switch(eval("(" + result + ")").result){
									case "success":
										$(".alert").html("审核成功").fadeToggle();
										$('#content').val("");
										$(".alert").fadeToggle(3000);
										break;
									default:
										$(".alert").html("审核失败").fadeToggle();
										$('#content').val("");
										$(".alert").fadeToggle(3000);
										break;
								}
							});
						});
					});
					$(".notpass").each(function(){
						$(this).click(function(){
							var modify_obj=$(this).parent().children().first().next();
							console.log(modify_obj);
							var tweets_id=$(this).parent().children().first().text();
							console.log($(this).parent().children().first());
							$('.modify').css({display:"block"});
							$('.modify_content').bind('click',function(){
								var tweets_content=$(this).parent().children('textarea').val();
								modify_obj.html(tweets_content);
								$.post("../../controllers/checksensitivity_word.php",{'tweets_id':tweets_id,'tweets_status':'2','tweets_content':tweets_content},function(result){
									console.log(result);
									switch(eval("(" + result + ")").result){
										case "success":
											$(".alert").html("审核成功").fadeToggle();
											$('#content').val("");
											$(".alert").fadeToggle(3000);
											break;
										default:
											$(".alert").html("审核失败").fadeToggle();
											$('#content').val("");
											$(".alert").fadeToggle(3000);
											break;
									}
								});
							});
						});
					});
				});
			});
		});
	});
});

/*************插件页面****************************/
$('.fifth_nav').bind('click',function(){
	nav_array[0].attr('src','../../IMG/send.png');
	nav_array[1].attr('src','../../IMG/data.png');
	nav_array[2].attr('src','../../IMG/member.png');
	nav_array[3].attr('src','../../IMG/fliter.png');
	nav_array[4].attr('src','../../IMG/plugs1.png');
	nav_array[5].attr('src','../../IMG/flow.png');
	$('.right_content').load('inc/plugin.html',function(){
		$('#plugin').ajaxForm({
			url: '../../controllers/plugincontroller.php',
        	error: failSubmit,
        	success: successSubmit,
        	restForm:true,　
        	dataType: 'json'
    	});
    	$('.img input').each(function(){
			$(this).change(function(){
				$(this).parent().next().css({display:"inline"});
				console.log($(this).parent().next());
				img_small(this);
			});
		});
		$('.zip input').each(function(){
			$(this).change(function(){
				$(this).parent().next().css({display:"inline"});
				var zip_url=$(this).val();
				console.log(zip_url);
				$(this).parent().siblings("div").html(zip_url);
			});
		});
	});
});
/*********************页面加载完*************************/
$(function(){
	var name=GetQueryString('name');
	console.log(name);
	setCookie('name',name);
	console.log(getCookie('name'));
	// 默认页面
	$('.right_content').load('inc/message_issue.html',function(){
		$('.add').bind('click',i=1,function(){
			var img=".img"+i;
			$(img).css({display:"inline"});
			i++;
			if(i==4){
				$(this).css({display:"none"});
			}
		});
		// alert("lalalla");
		$('#message_issue').ajaxForm({
			url: '../../controllers/message_issuecontroller.php',
        	error: failSubmit,
        	success: successSubmit,
        	 restForm:true,　
        	dataType: 'json'
    	});
		$('.img input').each(function(){
			$(this).change(function(){
				img_small(this);
			});
		});
	});
	$(".head_nav span").html(getCookie('name'));
});
function successSubmit(data){
	// console.log(data.responseText);
	// console.log(data);
	// 重新清空数据，消息发布时
	if(typeof $('.message_imgs')!='undefine'){
		$('.message_imgs').html(" ");
	}
	var result=eval("(" + data.responseText + ")").result;
	console.log(result);
	if(result=="1"){
		if(typeof eval("(" + data.responseText + ")").primsg=="undefine"){
			$(".alert").html("发布成功").fadeToggle();
			$(".alert").fadeToggle(3000);
		}else{
			$('.message_delete').css({'display':'block'});
			var primsg=eval("(" + data.responseText + ")").primsg;
			console.log(primsg);
			newMessage(primsg);
			$(".alert").html("发布成功").fadeToggle();
			$(".alert").fadeToggle(3000);
		}


	}else{
		$(".alert").html("发布失败").fadeToggle();
		$(".alert").fadeToggle(3000);
	}
}
function failSubmit(data){
	// 重新清空数据，消息发布时
	if(typeof $('.message_imgs')!='undefine'){
		$('.message_imgs').html(" ");
	}
	console.log(data);
	var result=eval("(" + data.responseText + ")").result;
	console.log(result);
	if(data.status==200&&data.statusText=="OK"&&result=="1"){
		if(typeof eval("(" + data.responseText + ")").primsg=="undefine"){
			$(".alert").html("发布成功").fadeToggle();
			$(".alert").fadeToggle(3000);
		}else{
			$('.message_delete').css({'display':'block'});
			var primsg=eval("(" + data.responseText + ")").primsg;
			console.log(primsg);
			newMessage(primsg);
			$(".alert").html("发布成功").fadeToggle();
			$(".alert").fadeToggle(3000);
		}
		console.log("success");
		$(".alert").html("发布成功").fadeToggle();
		$(".alert").fadeToggle(3000);
	}
	else{
		$(".alert").html("发布失败").fadeToggle();
		$(".alert").fadeToggle(3000);
	}
}
function img_small(data){
	var $file = $(data);
	var fileObj = $file[0];
	var windowURL = window.URL || window.webkitURL;
	var dataURL;
	var $img = $(data).parent().siblings("div").children('img');
				// alert($img.eq(0)[0].src);
	if(fileObj && fileObj.files && fileObj.files[0]){
		dataURL = windowURL.createObjectURL(fileObj.files[0]);
		$img.attr('src',dataURL);
	}else{
		dataURL = $file.val();
		var imgObj =$img.eq(0)[0] ;
		// 两个坑:
		// 1、在设置filter属性时，元素必须已经存在在DOM树中，动态创建的Node，也需要在设置属性前加入到DOM中，先设置属性在加入，无效；
		// 2、src属性需要像下面的方式添加，上面的两种方式添加，无效；
		imgObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
		imgObj.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = dataURL;
	}
}
function modifySensitivity(e){
// alert("sueecss");
	console.log(e.data.type);
	switch(e.data.type){
		case "1":
			var content=$('#content_add').val();
			break;
		case "2":
			var content=$('#content_delete').val();
			break;
		default:
		break;
	}
	console.log(content);
	//过滤字符为标准的;
	content=content.replace(/；/g,";");
	/*加载刚添加的敏感词*/
	$.post("../../controllers/sensitivitycontroller.php",{"type":e.data.type,"content":content},function(result){
		console.log(result);
		json_result = eval("(" + result + ")");
		switch(json_result.result){
			case "1":
				$(".alert").html("发布成功").fadeToggle();
				$('#content_delete').val("");
				$('#content_add').val("");
				$(".alert").fadeToggle(3000);
				break;
			default:
				$(".alert").html("发布失败").fadeToggle();
				$('#content_add').val("");
				$('#content_delete').val("");
				$(".alert").fadeToggle(3000);
				break;
		}
		console.log(e.data.type);
		console.log(json_result.array_content);
		for(key in json_result.array_content){
			console.log(key);
			console.log(json_result.array_content[key]);
			var classname="."+key;
			if(e.data.type=="1"){
				$(classname).css({display:"block"});
				varcontent="<li>"+json_result.array_content[key]+"</li>";			
				$(classname).append(varcontent);
				classname="."+key+" .head_li";
				console.log(classname);
				$(classname).html(key);
			}
			if(e.data.type=="2"){
				classname="."+key+" .head_li";
				if($(classname).siblings().length==1){
					$(classname).siblings().each(function(){
						$(this).parent().css({display:"none"});
					});
				}
				else{
					$(classname).siblings().each(function(){
						console.log($(this).text());
						if($(this).text()==json_result.array_content[key]){
							$(this).css({display:"none"});
						}
					});
				}
			}
		}
	});
}
function userListget(e){
	console.log(e.data.type);
	console.log(e.data.page);
	var page=1;
	if(e.data.type==1){
		if(e.data.page>1){
			page=parseInt(e.data.page)-1;
		}
	}
	if(e.data.type==2){
		page=parseInt(e.data.page)+1;
	}
	$.post('../../controllers/members.php',{'page':page},function(result){
		console.log("member:"+result);
		json_result = eval("(" + result + ")").result;
		switch(json_result){
			case "1":
				json_user= eval("(" + result + ")").users;
				var varcontent="<tr><td>user_id</td><td>user_name</td><td>粉丝数</td><td>关注数</td><td></td></tr>";
				$('.members table').html(varcontent);
				console.log(json_user);
				for (var i = json_user.length - 1; i >= 0; i--) {
					var user=json_user[i];
					var varcontent="<tr><td>"+user.user_id+"</td><td>"+user.user_name+"</td><td>"+user.follow_num+"</td><td>"+user.focus_num+"</td><td class=\'detail\'><button><img src=\'../../IMG/detail.png\'></button></td></tr>";
					$('.members table').append(varcontent);
				};
				break;
			default:
				$(".alert").html("刷新重新获取").fadeToggle();
				$(".alert").fadeToggle(3000);
				break;
		}
		$('.detail').each(function(){
			$(this).click(function(){
				var obj=$(this).parent().parent();
				var user_id=$(this).parent().children().first().text();
				console.log(user_id);
				$.post("../../controllers/user_detail.php",{'user_id':user_id},function(result){
					json_result=eval("(" + result + ")");
					console.log(json_result.user_name);
					var varcontent="<ul>";
					for(key in json_result){
						if(json_result[key]==""){
							continue;
						}
						if(key=="result"){
							continue;
						}
						varcontent+="<li><span>";
						varcontent+=key;
						varcontent+="</span>";
						varcontent+=json_result[key];
						varcontent+="</li>";
					}
					varcontent+="</ul>";
					console.log(varcontent);
					console.log(obj);
					$('.user_detail').html(varcontent);
				});
			});
		});
	});
}
// 消息发送后的显示函数message_issue,primsg是json对象
function newMessage(primsg){
	console.log(primsg.primsg_time);
	$('.message_delete ul li').each(function(){
		console.log($(this).attr('class'));
		switch($(this).attr('class')){
			case 'primsg_id':
				$(this).children().val(primsg.primsg_id);
				break;
			case 'time':
				$(this).children().val(primsg.primsg_time);
				break;
			case 'obj':
				$(this).children().val(primsg.message_obj);
				break;
			case 'type':
				$(this).children().val(primsg.message_type);
				break;
			case 'message_imgs':
				if(typeof primsg.message_imgs=='undefine'){
					$(this).html("");
				}else{
					var imghtml="发布图片:";
					var imgs=primsg.message_imgs.split(";");
					for (var i = imgs.length - 2; i >= 0; i--) {
						imghtml+="<img src=\'";
						imghtml+=imgs[i];
						imghtml+="\'/>";
					}
					$(this).append(imghtml);
				}
				break;
			case 'content':
				$(this).children().text(primsg.primsg_content);
				break;
			default:
				break;
		}
	});

}